package com.zkzx.company.api.controller.company;

import com.zkzx.common.company.command.CompanyCommand;
import com.zkzx.common.company.model.CompanyVO;
import com.zkzx.company.api.client.company.CompanyClient;
import com.zkzx.company.api.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @author young Email:yanghui@zkraising.com
 * @description
 * @company 北京中科智兴物联科技有限公司 @版权所有
 * @since 2021年05月08日 10时35分
 */
@RestController
@Validated
@Api(tags="企业管理 - 发票抬头管理")
@RequestMapping(value = "/company_invoice")
public class InvoiceController extends BaseController {

    @Autowired
    private CompanyClient companyClient;

    @GetMapping
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "获取企业发票抬头详细", notes = "获取企业发票抬头详细")
    public CompanyVO getById() {
        // 获取企业详细
        return companyClient.getById(super.getCompanyId());
    }


    @PutMapping
    @ResponseStatus(HttpStatus.OK)
    @ApiOperation(value = "修改企业发票抬头信息", notes = "修改企业发票抬头信息")
    public void update(@RequestBody @Valid CompanyCommand command) {
        // 修改企业信息
        companyClient.update(command,super.getCompanyId(),super.getUserId());
    }



}
